# src/main.py
import sys
from PyQt5.QtWidgets import QApplication
from ui.main_window import MainWindow

if __name__ == "__main__":
    app = QApplication(sys.argv)
    # 设置Minecraft风格的全局样式
    app.setStyleSheet("""
        /* Minecraft风格基础设置 */
        QWidget {
            font-family: "Minecraft", monospace;
            font-size: 16px;
            color: #FFFFFF;
            outline: none;
        }

        /* 标题样式 */
        QLabel {
            color: #FFFFFF;
            text-shadow: 2px 2px #000000;
            font-size: 16px;
        }

        /* 输入框样式 - 类似Minecraft告示牌 */
        QLineEdit, QTextEdit {
            padding: 8px;
            border: 4px solid;
            border-color: #8B4513 #CD853F #CD853F #8B4513;
            background-color: #F5DEB3;
            color: #000000;
            font-family: monospace;
            font-size: 16px;
            border-radius: 0;
        }

        /* 按钮样式 - 类似Minecraft木质按钮 */
        QPushButton {
            padding: 5px; /* 原来的一半 */
            background-color: #8B4513;
            color: #FFFFFF;
            border: 1px solid; /* 适当减小边框宽度 */
            border-color: #A0522D #6B3613 #6B3613 #A0522D;
            border-radius: 50%; /* 变为圆形 */
            text-shadow: 2px 2px #000000;
        }

        QPushButton:hover {
            background-color: #A0522D;
        }

        QPushButton:pressed {
            border-color: #6B3613 #A0522D #A0522D #6B3613;
        }

        /* 主按钮样式 - 类似Minecraft石头按钮 */
        QPushButton#mainButton {
            padding: 6px; /* 原来的一半 */
            background-color: #4CAF50;
            border: 1px solid; /* 适当减小边框宽度 */
            border-color: #66BB6A #388E3C #388E3C #66BB6A;
            border-radius: 50%; /* 变为圆形 */
        }

        QPushButton#mainButton:hover {
            background-color: #66BB6A;
        }

        QPushButton#mainButton:pressed {
            border-color: #388E3C #66BB6A #66BB6A #388E3C;
        }

        /* 下拉框样式 - 类似Minecraft箱子 */
        QComboBox {
            padding: 8px;
            border: 4px solid;
            border-color: #8B4513 #CD853F #CD853F #8B4513;
            background-color: #F5DEB3;
            color: #000000;
            border-radius: 0;
            text-shadow: 1px 1px #000000;
        }

        QComboBox::drop-down {
            subcontrol-origin: padding;
            subcontrol-position: top right;
            width: 20px;
            border-left-width: 4px;
            border-left-color: #8B4513;
            border-left-style: solid;
        }

        QComboBox::down-arrow {
            image: url();
        }

        QComboBox QAbstractItemView {
            border: 4px solid;
            border-color: #8B4513 #CD853F #CD853F #8B4513;
            background-color: #F5DEB3;
            color: #000000;
            selection-background-color: #A0522D;
            selection-color: #FFFFFF;
        }

        /* 滚动条样式 */
        QScrollBar:vertical {
            border: 2px solid #8B4513;
            background: #F5DEB3;
            width: 16px;
            margin: 0;
        }

        QScrollBar::handle:vertical {
            background: #A0522D;
            min-height: 20px;
            border: 2px solid;
            border-color: #CD853F #8B4513 #8B4513 #CD853F;
        }

        QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {
            height: 0;
        }

        QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
            background: none;
        }

        /* 菜单样式 */
        QMenu {
            background-color: #F5DEB3;
            border: 2px solid #8B4513;
        }

        QMenu::item {
            padding: 4px 20px;
            background-color: transparent;
            color: #000000;
        }

        QMenu::item:selected {
            background-color: #A0522D;
            color: #FFFFFF;
        }
    """)
    window = MainWindow()
    window.show()
    sys.exit(app.exec_())